package org.grow.common.config;

import org.grow.common.service.IDCodeGenerator;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author: xwg
 * @CreateDate: 2022/2/11
 */

@Configuration
public class CommonConfig {

    @Bean
    public ThreadLocal<IDCodeGenerator> idCodeGeneratorThreadLocal(ApplicationContext applicationContext) {
        return ThreadLocal.withInitial(() -> applicationContext.getBean(IDCodeGenerator.class));
    }
}
